//c++ 17
#include<iostream>
template<unsigned... N>
struct Cont {
};

template<typename T>
struct Reverse;

template<typename T, typename P, size_t S>
struct do_reverse;

template<unsigned... L>
struct Reverse<Cont<L...>> {
    using type = typename do_reverse<Cont<>, Cont<L...>, sizeof...(L)>::value;
};

template<unsigned N, unsigned... L1, unsigned... L2>
struct do_reverse<Cont<L2...>, Cont<N, L1...>, 1> {
    using value = Cont<N, L2...>;
};

template<unsigned N, size_t S, unsigned... L1, unsigned... L2>
struct do_reverse<Cont<L2...>, Cont<N, L1...>, S> {
    using value = typename do_reverse<Cont<N, L2...>, Cont<L1...>, (S - 1)>::value;
};

template<unsigned ...x>
void print_list(Cont<x...>) {
    ((std::cout << x << ","), ...);
}

int main() {
    //目标：翻转数列
    print_list(Reverse<Cont<1, 2, 3, 4, 5>>::type{});

    main();
}

